import { PureComponent } from "react"
// 定义高阶组件，给需要特殊数据的组件，注入props
function enhanceUserInfo(OriginComponent) {
  class NewComponent extends PureComponent {
    constructor() {
      super()

      this.state = {
        userInfo: {
          name: '张三',
          age: 18
        }
      }
    }

    render() {
      return <OriginComponent {...this.props} {...this.state.userInfo}></OriginComponent>
    }
  }

  return NewComponent
}

export default enhanceUserInfo